#!
# by jzhang @ 10:44 2004-01-05  mailto:v-jzhang
#  demo how to use recursive regex
#

$reg=qr{\((?:(?>[^()]+)|(??{$reg}))*\)};
$str="(a(12(b))(1]";
@contents=($str=~m/$reg/g);
print join("\n",@contents);
